package ${rootPkg}.service.${modelName}.${entityVar};

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.bitkit.basic.annotation.ServiceTag;
import cn.bitkit.component.BaseService;

import ${rootPkg}.pojo.dto.${modelName}.${entityVar}.${entityName}UpdateReq;
import ${rootPkg}.pojo.dto.${modelName}.${entityVar}.${entityName}UpdateResp;
import ${rootPkg}.pojo.entity.${modelName}.${entityName};
import ${rootPkg}.mapper.${modelName}.${entityName}Mapper;

@Service
@ServiceLabel("${entityVar}Update")
public class ${entityName}UpdateService implements BaseService<${entityName}UpdateReq, ${entityName}UpdateResp> {

    @Autowired
    ${entityName}Mapper ${entityVar}Mapper;

    @Override
    public ${entityName}UpdateResp execute(${entityName}UpdateReq req) {
        ${entityName} entity = ${entityVar}Mapper.selectById(req.getId());
        BeanUtils.copyProperties(req, entity);
        ${entityVar}Mapper.updateById(entity);
        ${entityName}UpdateResp resp = new ${entityName}UpdateResp();
        return resp;
    }
}